let KoaRouter = require('koa-router');
let jwt = require('jsonwebtoken');
let Fly = require("flyio/src/node")
let fly = new Fly;

// 3. 生成路由器对象
const router = new KoaRouter();


//1.获取图标字体的icon
let iconData = require('../datas/icon.json');
router.get('/getIconData', (ctx) => {
	ctx.body = iconData;
});
// 2.获取头部图片列表
let headerData = require('../datas/header.json')
router.get('/getCategoryList', (ctx) => {
	ctx.body = headerData;
});

//3.获取商品信息列表
let goodsList = require('../datas/goods.json')
router.get('/getGoodsList', (ctx) => {
	ctx.body = goodsList;
});
//4.生成首页轮播图
let bannerList = require('../datas/bannerList.json')
router.get('/getBannerList', (ctx) => {
	ctx.body = bannerList
})
// 5.获取分类列表
let categoryList = require('../datas/categoryList.json')
router.get('/getCategory', (ctx) => {
	ctx.body = categoryList
})
//6.分类列表之叶菜类
let foodTagsList1 = require('../datas/foodTagsList1.json')
let foodTagsList2 = require('../datas/foodTagsList2.json')
let foodTagsList3 = require('../datas/foodTagsList3.json')
let foodTagsList4 = require('../datas/foodTagsList4.json')
let foodTagsList5 = require('../datas/foodTagsList5.json')
router.get('/getFoodTagsList', (ctx => {
	let sort = ctx.query.sort
	if (sort === '1') {
		ctx.body = foodTagsList1
	} else if (sort === '2') {
		ctx.body = foodTagsList2
	} else if (sort === '3') {
		ctx.body = foodTagsList3
	} else if (sort === '4') {
		ctx.body = foodTagsList4
	} else if (sort === '5') {
		ctx.body = foodTagsList5
	}

}))

let goodsDetailInfo =require('../datas/detaiInfo.json')
router.get('/getDetailInfo',ctx=>{
	ctx.body=goodsDetailInfo
})
module.exports = router;
